Deploying the Java Pet Store Application on WebLogic Server
Step 1: Download and Install Java
2 SDK, Standard Edition v1.2.2
Step 2: Download WebLogic Server
version 5.1 and latest Service Pack
Step 3:
Install and Configure WebLogic Server and Service Pack
Step 4: Download
the Java Pet Store Application
Step 5: Install and Configure the
Java Pet Store Application
Step 6: Start WebLogic
Server
Step 7: Run the Java Pet Store
Application
Notes
Running Deployathon
Online! with an Oracle Database
Step 1: Download and Install Java 2 SDK, Standard Edition
v1.2.2
The Pet Sore application has been tested with WebLogic Server 5.1 running on
Java 2 SDK, Standard Edition v1.2.2. If Java
2, Standard Edition v1.2.2 is not already installed, you need to
install it now. To download and install Java 2 SDK, Standard Edition v1.2.2,
follow the instructions on the Java
2 SDK, Standard Edition v1.2.2 download page.
Step 2: Download WebLogic Server (WLS) version 5.1 and latest Service Pack
Download the version of WLS 5.1 that is appropriate for your platform
from the
BEA WebLogic Server download page.
Download the most recent Service Pack (SP3 or greater) for WLS 5.1 at
WebLogic Server Service Packs download page.
Step 3: Install and Configure WebLogic Server and Service Pack
Install WebLogic Server by following the instructions at
Installing and Setting Up WebLogic
Server 5.1.
Install the Service Pack by following the instructions included with the Service Pack.
Step 4: Download the Java Pet Store
Application
There are two parts to the Pet Store Application:
- The Pet Store Application file from Sun.
- The SecurityAdapter implementation that is specific to WebLogic Server.
Pet Store Application
You can download the Java Pet
Store Application from the Java(TM) 2 Platform, Enterprise
Edition Download and Specification page. Go to the section
"J2EETM Blueprints" and the
subsection "Java Pet Store sample application". You can download the
application in zip format, in Solaris script format, or as an InstallShield
executable for Windows NT.
To unzip the
downloaded application in zip format:
- Change your directory to the directory that contains the download, for
example:
cd /home/j2dep
Unzip the file: unzip
jps1_0.zip To extract the downloaded
application in Solaris script format:
- Change your directory to the directory that contains the download, for
example:
cd /home/j2dep
Make the downloaded file executable: chmod a+x
jps1_0-solsparc.sh
Execute the downloaded file: ./jps1_0-solsparc.sh
To extract the downloaded
application in InstallShield format double-click on the executable and follow the instructions.
WLS SecurityAdapter Implementation
Download the WLS SecurityAdapter Implementation petStoreWL.jar. Extract the jar
file into the root directory of your WLS 5.1 installation. This will create a
petStore directory under the root directory of your
WebLogic Distribution. This directory contains the classes for the SecurityAdapter implementation,
the classes for an RDBMSRealm implementation, the database used to store the RDBMSRealm information and
the Pet Store inventory/account information, the source files for the security implementation, and shell scripts
used to configure and start the Pet Store application.
Step 5: Install and Configure the Java Pet Store
Application
- From the root directory of your WebLogic Server installation, set up your
development environment by executing the
setEnv (.cmd
for NT or .sh for UNIX) shell script.
- Copy the estore.ear
file from the Pet Store Application installation into the
weblogic/petStore directory where
weblogic is the WebLogic Server
installation directory.
- cd to the
weblogic/petStore
directory and execute the port2WL
(.cmd
for NT or .sh for UNIX) shell script.
This script unpacks the ear file,
generates the EJB container classes, and includes the appropriate WebLogic-specific deployment descriptors.
- Add the name of the SecurityAdapter implementation class to the deployment descriptors
for the EJBs and Web Application by performing the following steps:
- Edit weblogic/petStore/petStoreServer/estore/WEB-INF/web.xml so that
the values of the <form-login-page> and
<form-error-page> tags are as follows:
<form-login-page>/control/formbasedlogin</form-login-page>
<form-error-page>/control/formbasedloginerror</form-error-page>
- The following steps apply to the weblogic/petStore/weblogic.properties
file:
- Configure a system password by editing the weblogic.password.system
property.
weblogic.password.system=password
- weblogic/petStore/weblogic.properties was created
assuming that WebLogic was installed in the default location on a Windows NT machine. If you have installed
in another location or platform, search the properties file for the string
"c:/weblogic" and replace it with the appropriate directory.
- Configure JSP pages with the following properties:
weblogic.httpd.register.*.jsp=\
weblogic.servlet.JSPServlet
weblogic.httpd.initArgs.*.jsp=\
pageCheckSeconds=1,\
compileCommand=jdk_home/bin/javac.exe,\
workingDir=weblogic_home/petstore/classfiles,\
verbose=true,\
keepgenerated=true
where jdk_home is the installation directory
of your Java 2 SDK and
weblogic_home is the installation directory of WebLogic Server.
- Edit weblogic/petStore/startPetStore (
.cmd for NT, .sh
for UNIX) by adding the Service Pack jar file to the PRE_CLASSPATH
variable.
Step 6: Start WebLogic Server
To start WebLogic Server,
cd to the weblogic/petStore
directory and execute the startPetStore (
.cmd for NT, .sh
for UNIX) shell script.
Step 7: Run the Java Pet Store
Application
Notes
- It might take a while for a page to appear for the first time after
you deploy the pet store application or when a J2EE server is restarted.
Please be patient. JSP pages are compiled to servlets on demand, so an
initial access to a web page that invokes JSPs incurs some extra latency.
Subsequent access to the web page is faster.
Running Deployathon Online! with an Oracle
Database
The Pet Store application is pre-configured to work with the evaluation version
of Cloudscape that is included in the WebLogic Server distribution. If you
would like to use Oracle with Pet Store, follow the steps below.
- Create the database tables by executing
weblogic/petStore/WLSrc/db/petStore.ddl with
utils.Scema.
First, edit petStore.ddl
and make any changes required for your DBMS. Be sure
not to change the table or column names. See
WebLogic Utilities for help using
utils.Scema.
- Edit the weblogic/rdbmsrealm.properties file.
The rdbmsrealm.properties file
contains two sections. In the first section, you set properties for
your JDBC driver and the database where you created the RDBMSRealm
tables.
The Cloudscape JDBC driver is selected by default. If you want to use
a different database, comment out the Cloudscape properties and
uncomment the properties for the driver you want to use. Edit the
properties so that they correct for your database.
- The driver property is the full
classname of the JDBC driver, which must be in the WebLogic Server
classpath.
- The dbURL property is the
database URL for the database, as specified by your JDBC driver documentation.
- The dbUser property is the
database username.
- The dbPassword property is
the password for the database user.
- Edit weblogic/petStore/weblogic.properties file. For the InventoryPool and
EstorePool connection pools, edit the
properties:
- url - the database URL for the
database, as specified by your JDBC driver documentation.
- driver - the full classname of the
JDBC driver, which must be in the WebLogic Server classpath.

|